!==========================================================================
! BSAM: Block-Structured Adaptive Multigrid Solver
!==========================================================================
!
! (c) Copyright Steven M. Wise, 2006
! Department of Mathematics
! University of California at Irvine
! swise@math.uci.edu
!
! (c) Copyright Steven M. Wise, 2007
! Department of Mathematics
! University of Tennessee
! swise@math.utk.edu
!
! -----------------------------------------------------------------------
! This software is made available for research and instructional use only.
! You may copy and use this software without charge for these
! non-commercial purposes, provided that the copyright notice and
! associated text is reproduced on all copies.  For all other uses,
! including distribution of modified versions, please contact the authors.
!
! Commercial use is strictly forbidden without permission.
!
! This software is made available "as is" without any assurance that it
! will work for your purposes. The software may in fact have defects,
! so use the software at your own risk.
!
! -----------------------------------------------------------------------
! File:             problemdef.f90
! Purpose:          BSAM problem parameter allocation module.
! Contains:
! Revision History: Ver. 1.0 Oct. 2006 Steven Wise
! Revision History: Ver. 1.1 May  2007 Steven Wise
! -----------------------------------------------------------------------
module ProblemDef
use NodeInfoDef, only: r8
implicit none
! Variables in q-array
integer, parameter :: qus  = 1  ! u*-component of velocity
integer, parameter :: qvs  = 2  ! v*-component of velocity
integer, parameter :: qpsi = 3  ! pressure difference
integer, parameter :: qu   = 4  ! u-component of velocity
integer, parameter :: qv   = 5  ! v-component of velocity
integer, parameter :: qp   = 6  ! pressure
integer, parameter :: qum  = 7  ! u(t-1)-component of velocity
integer, parameter :: qvm  = 8  ! v(t-1)-component of velocity
integer, parameter :: qmac = 9  ! MAC - projection
integer, parameter :: qc   = 10 ! Phase-field function
integer, parameter :: qmu  = 11 ! Chemical potential
integer, parameter :: qcm  = 12 ! Phase-field function at previous time step
integer, parameter :: qb   = 13 ! Bulk surfactant concentration
integer, parameter :: qf   = 14 ! Interface surfactant concentration
integer, parameter :: qbm  = 15 ! Bulk surfactant concentration
integer, parameter :: qfm  = 16 ! Interface surfactant concentration
integer, parameter :: qsig = 17 !
integer, parameter :: qcap = 18 !
integer, parameter :: qmar = 19 !
integer, parameter :: qdiv = 20 ! div(u)

integer, parameter :: old = 3 ! shift from qus to qu to qum

! Equations - these must be in the correct order of solution
integer, parameter :: eq_mac        = 1 ! MAC - projection
integer, parameter :: eq_ch         = 2 ! Cahn-Hilliard system
integer, parameter :: eq_surfac     = 3 ! Surfactant system
integer, parameter :: eq_advecdiff  = 4 ! Advection-diffusion
integer, parameter :: eq_projection = 5 ! Projection
integer, parameter :: eq_update     = 6 ! Velocity/pressure updates
integer, parameter :: eq_normalize  = 7 ! Normalize pressure

! Physical parameters
real, dimension(2) :: rho ! Density ! TODO not working very well...
real, dimension(2) :: mu  ! Dynamic viscosity
real, dimension(qus:qvs) :: g  ! Gravity vector
!real :: sigma0  ! Surface tension of clean interface
real :: beta    ! Elasticity number
real :: f_inf   ! Maximum surfactant concentration
real :: f_eq    ! Equilibrium surfactant concentration
real :: b_eq    ! Maximum bulk concentration
real :: r_a, r_d! Adsorption and desorption coefficients
real :: surfdiff, bulkdiff  ! Diffusion coeffs 

real :: cap

! Problem-dependent parameters
real :: radius=1.0
real :: cavity_speed=1.0

! Numerical parameters
logical :: axisym=.false.
real :: eps,eps2 ! Interface thickness
real,parameter :: alpha = 6.0*sqrt(2.0) ! Phase-field constant
real :: max_p=-1e5, min_p=1e5, max_psi=-1e5, min_psi=1e5 ! Hack...
!
public

end module ProblemDef
